Skip to content

feat: Add mark_emails tool for marking emails as read/unread#102

Open
jbkjr wants to merge 3 commits intoai-zerolab:mainfrom
jbkjr:pr/mark-read-unread
Open

feat: Add mark_emails tool for marking emails as read/unread#102
jbkjr wants to merge 3 commits intoai-zerolab:mainfrom
jbkjr:pr/mark-read-unread

Conversation

@jbkjr
Copy link
Contributor

@jbkjr jbkjr commented Jan 15, 2026

Summary

  • Adds mark_emails MCP tool to mark emails as read or unread using IMAP \Seen flag
  • New EmailMarkResponse model for operation results
  • Supports batch operations with success/failure tracking per email

Changes

  • mcp_email_server/emails/models.py - Added EmailMarkResponse model
  • mcp_email_server/emails/__init__.py - Added abstract mark_emails method to EmailHandler
  • mcp_email_server/emails/classic.py - Implemented in EmailClient and ClassicEmailHandler
  • mcp_email_server/app.py - Exposed MCP tool with mark_as parameter ("read" or "unread")

Test plan

  • Test marking single email as read
  • Test marking single email as unread
  • Test batch marking multiple emails
  • Test with different mailboxes (INBOX, custom folders)
  • Verify failed_ids tracking when email doesn't exist

🤖 Generated with Claude Code

@codecov
Copy link

codecov bot commented Jan 15, 2026

Codecov Report

❌ Patch coverage is 90.47619% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
mcp_email_server/app.py 50.0% 2 Missing ⚠️
mcp_email_server/emails/classic.py 93.3% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Wh1isper Wh1isper self-assigned this Jan 19, 2026
@Wh1isper
Copy link
Member

Can you resolve the conflict?

@jbkjr jbkjr force-pushed the pr/mark-read-unread branch from 08b01e5 to a2964f1 Compare January 25, 2026 13:44
@jbkjr
Copy link
Contributor Author

jbkjr commented Jan 25, 2026

Merge conflicts resolved - rebased onto main. Ready for review.

Add functionality to mark emails as read or unread using IMAP \Seen flag:
- EmailMarkResponse model for operation results
- mark_emails abstract method in EmailHandler
- Implementation in EmailClient and ClassicEmailHandler
- MCP tool exposed via app.py

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jbkjr jbkjr force-pushed the pr/mark-read-unread branch from a2964f1 to 7f194a2 Compare January 26, 2026 06:25
pre-commit-ci bot and others added 2 commits January 26, 2026 06:25
Add tests covering all code paths in the mark_emails method:
- Mark emails as read (using +FLAGS)
- Mark emails as unread (using -FLAGS)
- Partial failure handling
- Invalid mark_as value raises ValueError
- Custom mailbox selection
- Logout error handling

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants